package com.tianqu.tms.www.car.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.TmsAjaxAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.exception.TmsException;
import com.tianqu.tms.dto.MarketCarInfoDto;
import com.tianqu.tms.entity.Car;

import net.sf.json.JSONObject;

public class CarOwnerInfoAjaxAction extends TmsAjaxAction {

	@Override
	public void process(ActionMapping mapping, ActionForm form, HttpServletRequest request,
			HttpServletResponse response, UserContext uc) throws TmsException {
		String id = request.getParameter("id");
		Car car = Car.getInstance();
		MarketCarInfoDto info = car.getCarOwnerById(id);
		JSONObject json = new JSONObject();
		json.put("id", info.getId());
		json.put("carOwner", info.getCarOwner());
		json.put("ownerPhone", info.getOwnerPhone());
		json.put("ownerCardNo", info.getOwnerCardNo());
		json.put("ownerAddress", info.getOwnerAddress());
		json.put("ownertype", info.getOwnerType());
		responseValues(response, json.toString(), TEXT);
	}

}
